<include file="Public/header" />
  
  <body>
  <div class="layui-container" style="margin-top: 10px;">
    <div class="layui-row">
      <div class="layui-col-md12">        
        <form class="layui-form" >
            <div class="layui-form-item">
              <label class="layui-form-label">项目名称</label>
              <div class="layui-input-block">
                <input type="text" name="title" required  lay-verify="required" placeholder="请输入导入项目名称" autocomplete="off" class="layui-input" id="title">
              </div>
            </div>
             <div class="layui-form-item">
              <label class="layui-form-label">学校</label>
              <div class="layui-input-block">
                <select name="schoolid" lay-verify="required" id="schoolid">
                  <option value="">请选择学生就读学校</option>
                   <if condition="$Think.session.type eq 2 ">
                  <option value="1">孝义中学</option>
                  <option value="2">孝义二中</option>
                  <option value="3">孝义三中</option>
                  <option value="4">孝义四中</option>
                  <option value="5">孝义五中</option>
                  <option value="6">孝义实验中学</option>
                  <option value="7">孝义华杰中学</option>
                  <option value="8">孝义艺苑中学</option>
                  <else/>
                  <option value="<{$Think.session.schoolid}>"><{$Think.session.schoolid|getschool}></option>
                  </if>
                </select>
              </div>
            </div>
           <!--  <div class="layui-form-item">
              <label class="layui-form-label">入学年份</label>
                <div class="layui-input-block">
                  <select name="year" lay-verify="required" id="year">
                    <option value="">请选择入学年份</option> 
                    <option value="2016">2016</option>
                    <option value="2017">2017</option>
                    <option value="2018">2018</option>
                    <option value="2019">2019</option>
                    <option value="2020">2020</option>
                  </select>
                </div>
            </div> -->
            <div class="layui-form-item">
              <div class="layui-input-block">
              <!-- <a class="layui-btn" href="javascript:;" lay-submit onclick="sub('<{$te.tid}>')">立即提交</a> -->
              <!-- <button class="layui-btn" lay-submit onsubmit="sub('<{$te.tid}>')">立即提交</button> -->
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
              </div>
            </div>
          </form>
        </div>
    </div>
</div> 
<script>

//Demo
layui.use('form', function(){
  var form = layui.form;
  
  //监听提交
  form.on('submit(formDemo)', function(){
    // layer.msg(JSON.stringify(data.field));
    //alert(data.field.tname);
    var title=$('#title').val(),schoolid=$('#schoolid').val();
    //alert(sname);
    $.post("<{:U('do_inadd')}>",{title:title,schoolid:schoolid},function(data,status){
          //alert("Data: " + data + "\nStatus: " + status);
          if (data >= 1) {
            layer.msg('添加成功!',{icon: 6,time:2000});
            setTimeout("x_admin_close()",1000);
            setTimeout("window.parent.location.reload()",1000);
          } else{
            layer.msg('添加失败，请重试！或联系管理员！',{icon: 5,time:1000});
            //x_admin_close();
          } 
      });
    return false;
  });
});

</script>
</body>
</html>